import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { RowVO, RowForm, RowQuery } from '@/api/cemetery/row/types';

/**
 * 查询墓穴排数列表
 * @param query
 * @returns {*}
 */

export const listRow = (query?: RowQuery): AxiosPromise<RowVO[]> => {
  return request({
    url: '/cemetery/row/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询墓穴排数详细
 * @param id
 */
export const getRow = (id: string | number): AxiosPromise<RowVO> => {
  return request({
    url: '/cemetery/row/' + id,
    method: 'get'
  });
};

/**
 * 新增墓穴排数
 * @param data
 */
export const addRow = (data: RowForm) => {
  return request({
    url: '/cemetery/row',
    method: 'post',
    data: data
  });
};

/**
 * 修改墓穴排数
 * @param data
 */
export const updateRow = (data: RowForm) => {
  return request({
    url: '/cemetery/row',
    method: 'put',
    data: data
  });
};

/**
 * 删除墓穴排数
 * @param id
 */
export const delRow = (id: string | number | Array<string | number>) => {
  return request({
    url: '/cemetery/row/' + id,
    method: 'delete'
  });
};
